﻿'© 2004 - 2008 ActiveModules, Inc. All Rights Reserved
Namespace DotNetNuke.Modules.ActiveForums
    Partial Public Class admin_tags
        Inherits ActiveAdminBase

#Region "Event Handlers"
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        End Sub

        Private Sub agTags_Callback(ByVal sender As Object, ByVal e As Modules.ActiveForums.Controls.CallBackEventArgs) Handles agTags.Callback
            Try
                If Not e.Parameters(4) = "" Then
                    Dim sAction As String = e.Parameters(4).Split(CChar(":"))(0)

                    Select Case sAction.ToUpper
                        Case "DELETE"
                            Dim TagId As Integer = CInt(e.Parameters(4).Split(CChar(":"))(1))
                            If IsNumeric(TagId) Then
                                DataProvider.Instance.Tags_Delete(PortalId, ModuleId, TagId)
                            End If
                        Case "SAVE"
                            Dim sParams() As String = e.Parameters(4).Split(CChar(":"))
                            Dim TagName As String = sParams(1).Trim
                            Dim TagId As Integer = 0
                            If sParams.Length > 2 Then
                                TagId = CInt(sParams(2))
                            End If
                            If Not TagName = String.Empty Then
                                DataProvider.Instance.Tags_Save(PortalId, ModuleId, TagId, TagName, 0, 0, 0, -1, False, -1, -1)
                            End If



                    End Select

                End If
                agTags.DefaultParams = String.Empty
                Dim PageIndex As Integer = CInt(e.Parameters(0))
                Dim PageSize As Integer = CInt(e.Parameters(1))
                Dim SortColumn As String = e.Parameters(2).ToString
                Dim Sort As String = e.Parameters(3).ToString
                agTags.Datasource = DataProvider.Instance.Tags_List(PortalId, ModuleId, False, PageIndex, PageSize, Sort, SortColumn, -1, -1)
                agTags.Refresh(e.Output)
            Catch ex As Exception

            End Try

        End Sub

        Private Sub agTags_ItemBound(ByVal sender As Object, ByVal e As Modules.ActiveForums.Controls.ItemBoundEventArgs) Handles agTags.ItemBound
            'e.Item(1) = Server.HtmlEncode(e.Item(1).ToString)
            'e.Item(2) = Server.HtmlEncode(e.Item(2).ToString)
            e.Item(4) = "<img src=""" & Page.ResolveUrl("~/desktopmodules/activeforums/images/delete16.png") & """ alt=""" & GetSharedResource("[RESX:Delete]") & """ height=""16"" width=""16"" />"
        End Sub
#End Region


    End Class
End Namespace
